# Maintainer: Ryuta Suzuki <oroppas@gmail.com>

_realname=win_unicode_console
pkgbase=mingw-w64-python-${_realname}
pkgname=(
  "${MINGW_PACKAGE_PREFIX}-python3-${_realname}"
  "${MINGW_PACKAGE_PREFIX}-python2-${_realname}"
)
pkgver=0.5
pkgrel=1
pkgdesc="Measures number of Terminal column cells of wide-character codes"
url="https://github.com/Drekin/win-unicode-console"
arch=('any')
license=('MIT')
makedepends=(
  "${MINGW_PACKAGE_PREFIX}-python3-setuptools"
  "${MINGW_PACKAGE_PREFIX}-python2-setuptools"
)
source=(win-unicode-console-${pkgver}.tar.gz::https://github.com/Drekin/win-unicode-console/archive/${pkgver}.tar.gz)
sha256sums=('2eca3277096ddf88f852b667fcdd866a342500f86c6e10cce9842420290d5048')

prepare() {
  cp -a win-unicode-console-${pkgver}{,-py2}
}

build() {
  cd ${srcdir}/win-unicode-console-${pkgver}
  python3 setup.py build

  cd ${srcdir}/win-unicode-console-${pkgver}-py2
  python2 setup.py build
}

package_python3-win_unicode_console() {
  depends=("${MINGW_PACKAGE_PREFIX}-python3")

  cd ${srcdir}/win-unicode-console-${pkgver}
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python3 setup.py install --root=${pkgdir} --prefix=${MINGW_PREFIX} --optimize=1
  install -Dm644 LICENSE ${pkgdir}${MINGW_PREFIX}/share/licenses/python3-${_realname}/LICENSE
}

package_python2-win_unicode_console() {
  depends=("${MINGW_PACKAGE_PREFIX}-python2")

  cd ${srcdir}/win-unicode-console-${pkgver}-py2
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python2 setup.py install --root=${pkgdir} --prefix=${MINGW_PREFIX} --optimize=1
  install -Dm644 LICENSE ${pkgdir}${MINGW_PREFIX}/share/licenses/python2-${_realname}/LICENSE
}

package_mingw-w64-i686-python2-win_unicode_console() {
  package_python2-win_unicode_console
}

package_mingw-w64-i686-python3-win_unicode_console() {
  package_python3-win_unicode_console
}

package_mingw-w64-x86_64-python2-win_unicode_console() {
  package_python2-win_unicode_console
}

package_mingw-w64-x86_64-python3-win_unicode_console() {
  package_python3-win_unicode_console
}

# vim:set ts=2 sw=2 et:
